﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
using System.Net;

namespace MidApp
{
    public class Mailer
    {
        private static string From = "ui.no.reply.ever@gmail.com";
        private static string Server = "smtp.gmail.com";
        private static int Port = 587;

        public static void Send(string Recipient, string Subject, string Message)
        {
            MailMessage mail = new MailMessage();

            mail.To.Add(Recipient);

            mail.From = new System.Net.Mail.MailAddress(From);

            mail.Subject = Subject;

            mail.Body = Message;

            SmtpClient smtp = new SmtpClient(Server, Port);
            smtp.EnableSsl = true;
            smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
            smtp.UseDefaultCredentials = false;

            smtp.Credentials = new NetworkCredential(mail.From.Address, "lokomotiva10");
            smtp.Send(mail);
        }
    }
}
